<?php
/**
 * 描述：交易频道-主页。
 * @final
 */
final class Exec_Transaction_Index extends Exec
{
    public function Get()
    {
        #获取最新采购信息数据
        $procurements=DB::GetRows('select * from procurement order by Datetime desc limit 0,15');
        View::Assign('Procurements',$procurements);

        #获取最新供应信息数据
        $supplies=DB::GetRows('select * from supply order by Datetime desc limit 0,15');
        View::Assign('Supplies',$supplies);

        #获取诚信供应商数据
        $sql='select * from account ';
        $sql=$sql.'where not exists(select * from account_locked where account.Username=account_locked.Account limit 0,4) ';                      //不锁定
        $sql=$sql.'and not exists(select * from account_delete where account.Username=account_delete.Account limit 0,4) ';                        //没删除
        $sql=$sql.'and exists(select * from account_email_verification where account.Username=account_email_verification.Account limit 0,4) ';    //己通过邮件验证
        $sql=$sql.'and exists(select * from account_integrity where account.Username=account_integrity.Account limit 0,4) ';                      //己通过诚信供应商
        $sql=$sql.'order by Datetime desc limit 0,4';
        $account=DB::GetRows($sql);
        foreach($account as $key=>$value)
        {
            $account[$key]['Logo']=Config::PATH_RELATIVE_ATTACHMENT_TEMP.'/'.$account[$key]['Logo'];
        }                        
        View::Assign('Suppliers',$account);

        #获取采购推荐数据
        $procurement=DB::GetRows('select * from procurement where M_Recommend_Is=true order by M_Recommend_Datetime desc,Datetime desc limit 0,4');
        foreach($procurement as $key=>$value)
        {
            $procurement[$key]['ThumbnailPath']=Config::PATH_RELATIVE_ATTACHMENT_PROCUREMENT.'/'.$procurement[$key]['ThumbnailPath'];
        }
        View::Assign('Procurements_Recommend',$procurement);
        
        #获取产品超市
        $supplies=DB::GetRows('select * from supply where M_Recommend_Is=true order by M_Recommend_Datetime desc,Datetime desc limit 0,4');
        foreach($supplies as $key=>$value)
        {
            $supplies[$key]['ThumbnailPath']=Config::PATH_RELATIVE_ATTACHMENT_SUPPLY.'/'.$supplies[$key]['ThumbnailPath'];
        }
        View::Assign('Supplies_Supermarket',$supplies);

        #获取网上展会数据(展会专题数据)
        #

        #获取网下展会数据(除展会专题外)
        //$exhibitions=DB::GetRows('select * from exhibition_infos where ClassID<>'.DAO_ExhibitionClass::TOPIC.' order by Datetime desc limit 0,3');
        View::Assign('Exhibitions',NULL);

        #获取数据-成功分享
        $shares=DB::GetRows('select * from news where SubclassID='.DAO_NewsClass::Transaction_Share_ID.' and M_IsDelete=FALSE order by ID desc limit 0,6');
        View::Assign('NewsClass_TransactionShare_ID',DAO_NewsClass::Transaction_Share_ID);
        View::Assign('Shares',$shares);

        #渲染输出
        View::Display('transaction/index.tpl');
    }
}
?>